package weaver.interfaces.zwgk.utils;

import weaver.general.BaseBean;

import java.util.HashMap;
import java.util.Map;

/**
 * @Title: ecology-idea
 * @Company: 泛微软件
 * @author: weaver.Dusongsong
 * @version: 1.0
 * @CreateDate: 2022-05-11
 * @Description: 一体化合同管理系统上报数据接口
 * @ModifyLog:
 **/

public class InvokeHelper {
    public static final String Sellcont = "Sellcont";
    public static final String BatchSellcont = "BatchSellcont";
    public static final String ChangeSellcont = "ChangeSellcont";
    public static final String BatchChangeSellcont = "BatchChangeSellcont";
    public static final String Paycont = "Paycont";
    public static final String BatchPaycont = "BatchPaycont";
    public static final String Proceeds ="proceeds";
    public static final String BatchProceeds ="BatchProceeds";

    private static Map map = new HashMap();
    static {
        map.put(Sellcont, "api/sellcont/insert");
        map.put(BatchSellcont, "api/sellcont/insertList");
        map.put(ChangeSellcont, "api/change/insert");
        map.put(BatchChangeSellcont, "api/change/insertList");
        map.put(Paycont, "api/paycont/insert");
        map.put(BatchPaycont, "api/paycont/insertList");
        map.put(Proceeds,"api/proceeds/insert");
        map.put(BatchProceeds,"api/batchproceeds/insert");
    }


    public static String Invoke(String type,String params){
        BaseBean baseBean = new BaseBean();
        String URL = baseBean.getPropValue( "laisi", "url" );
        String url = URL+map.get(type);
        Map<String, String> header = new HashMap<>();
        header.put( "ContentType", "application/json" );
        String ecode = "UTF-8";
        return HttpUtil.httpPostRaw( url, params, header, ecode );
    }
    /**
     * @Description: 新增销售合同信息
     * @Param: [params]
     * @return: java.lang.String
     * @Author: Dusongsong
     * @Date: 2022/5/11
     */
    public static String addSellcont(String params) {
        return Invoke(Constant.Sellcont, params);
    }

    public static String addProceeds(String params) {
        return Invoke(Constant.Proceeds, params);
    }

    public static String addBatchProceeds(String params) {
        return Invoke(Constant.BatchProceeds, params);
    }

    /**
     * @Description: 批量新增销售合同信息
     * @Param: [params]
     * @return: java.lang.String
     * @Author: Dusongsong
     * @Date: 2022/5/11
     */
    public static String addBatchSellcont(String params) {
        return Invoke(Constant.BatchSellcont, params);
    }

    /**
     * @Description: 新增销售合同变更信息
     * @Param: [params]
     * @return: java.lang.String
     * @Author: Dusongsong
     * @Date: 2022/5/11
     */
    public static String addChangeSellcont(String params) {
        return Invoke(Constant.ChangeSellcont, params);
    }

    /**
     * @Description: 批量新增销售合同变更信息
     * @Param: [params]
     * @return: java.lang.String
     * @Author: Dusongsong
     * @Date: 2022/5/11
     */
    public static String addBatchChangeSellcont(String params) {
        return Invoke(Constant.BatchChangeSellcont, params);
    }
    /**
     * @Description: 新增采购合同信息
     * @Param: [params]
     * @return: java.lang.String
     * @Author: Dusongsong
     * @Date: 2022/5/11
     */
    public static String addPaycont(String params) {
        return Invoke(Constant.Paycont, params);
    }
    /**
     * @Description: 批量新增采购合同信息
     * @Param: [params]
     * @return: java.lang.String
     * @Author: Dusongsong
     * @Date: 2022/5/11
     */
    public static String addBatchPaycont(String params) {
        return Invoke(Constant.BatchPaycont, params);
    }
}
